package net.muchine.core.service;

import javax.annotation.PostConstruct;

import net.muchine.core.dao.GenericDao;

public abstract class GenericServiceImpl<T, K> implements
		GenericService<T, K> {

	private GenericDao<T, K> dao;
	
	public void setDao(GenericDao<T, K> dao) {
		this.dao = dao;
	}
	
	@PostConstruct
	public abstract void setGenericDao();
	
	public int create(T entity) {
		return dao.create(entity);
	}

	public int update(T entity) {
		return dao.update(entity);
	}

	public int delete(K key) {
		return dao.delete(key);
	}

	public T find(K key) {
		return dao.find(key);
	}

	public long countAll() {
		return dao.countAll();
	}
}
